﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using ABC.Business.Models;
using ABC.Core.Configuration;
using ABC.Domain.Entities;

namespace ABC.Controllers.ViewModels.My
{
    public class MyDeliveryViewModel : BaseViewModel
    {
        public string Service { get; set; }

        public List<InfoClient> Clients { get; set; }

        public string ProductType { get; set; }

        public List<SelectListItem> ListForProductType { get; set; }

        public List<SelectListItem> ListForCompanies { get; set; }

        public List<EditCalc> ConfirmedCalculationsKasko { get; set; }

        public List<EditCalc> ConfirmedCalculationsOsago { get; set; }

        public string InsurantId { get; set; }

        public string Name { get; set; }

        public string Phone { get; set; }

        public string Email { get; set; }

        public string Address { get; set; }

        public string Date { get; set; }

        public string TimeWith { get; set; }

        public string TimeTo { get; set; }

        public string MeansPayment { get; set; }

        public bool Urgently { get; set; }

        public string Notes { get; set; }

        public List<SelectListItem> ListForMeansPayment { get; set; }

        public List<DictionaryItem> KaskoDocuments { get; set; }

        public List<DictionaryItem> OsagoDocuments { get; set; }

        public MyDeliveryViewModel()
        {
            var financeModel = IoC.Resolve<FinanceModel>();
            var clientsModel = IoC.Resolve<ClientsModel>();
            Clients = new List<InfoClient>();
            KaskoDocuments = new List<DictionaryItem>();
            OsagoDocuments = new List<DictionaryItem>();
            KaskoDocuments = clientsModel.GetDocuments("каско").Select(x => new DictionaryItem { Name = x.Value, Id = x.Key }).ToList();
            OsagoDocuments = clientsModel.GetDocuments("осаго").Select(x => new DictionaryItem { Name = x.Value, Id = x.Key }).ToList();
            ListForProductType = new List<SelectListItem>();
            ListForProductType = financeModel.GetTypesOfInsurance().Select(x => new SelectListItem { Value = x.Key, Text = x.Value }).
                    ToList();
            ConfirmedCalculationsKasko = new List<EditCalc>();
            ConfirmedCalculationsOsago = new List<EditCalc>();
            ListForCompanies = new List<SelectListItem>();
            ListForMeansPayment = new List<SelectListItem>
                                      {
                                          new SelectListItem { Text = "Наличный расчет", Value = "Наличный расчет" },
                                          new SelectListItem { Text = "Банковской картой", Value = "Банковской картой"},
                                          new SelectListItem { Text = "Безналичный расчет", Value = "Безналичный расчет"}
                                      };
        }
    }
}
